package cn.play.cardgame.util;

import java.util.HashMap;
import java.util.Map;

public class CardMappingUtil {
	private static CardMappingUtil mInstance;
	private static Map<String, String> CARD_MAPPING;

	static {
		CARD_MAPPING = new HashMap<String, String>();
		CARD_MAPPING.put("S", "heixin");
		CARD_MAPPING.put("H", "hongxin");
		CARD_MAPPING.put("C", "caohua");
		CARD_MAPPING.put("D", "fangkuai");
		CARD_MAPPING.put("B", "a");
		CARD_MAPPING.put("L", "b");
	}

	public static Map<String, String> getCardMapping() {
		return CARD_MAPPING;
	}

	public static CardMappingUtil getInstance() {
		if (mInstance == null)
			mInstance = new CardMappingUtil();
		return mInstance;
	}

	private CardMappingUtil() {
	}

	/**
	 * "S"：黑, "C"：梅, "H"：红, "D"：方, "L"：小, "B"：大
	 *
	 */
	public String getPaiHuase(String color) {
		return CARD_MAPPING.get(color);
	}

	/**
	 *
	 * "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "O"：王
	 *
	 */
	public String getPaiValue(String num) {
		if (num.equals("O"))
			return "";
		else if (num.equals("A"))
			return "1";
		else
			return num.toLowerCase();
	}
}
